package com.yhy.enums;

import lombok.Getter;

@Getter
public enum ResultEnums {
    SUCCESS(200, "成功"),
    FAIL(500, "失败"),
    ;
    public int code;
    public String desc;

    ResultEnums(int code, String desc) {
        this.code = code;
        this.desc = desc;

    }
    public static ResultEnums getEnum(int code) {
        for (ResultEnums resultEnum : ResultEnums.values()) {
            if (resultEnum.getCode() == code) {
                return resultEnum;
            }
        }
        return null;
    }
}
